package com.hhf.rpc.easy.registry;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author hhf
 * @Date 2024/10/15
 * @Description
 */
public class LocalRegistry {

    /**
     * 注册信息存储
     */
    private static final Map<String,Class<?>> map = new ConcurrentHashMap<>();


    /**
     * 服务注册
     * @param serviceName
     * @param implClass
     */
    public static void register(String serviceName,Class<?> implClass){
        map.put(serviceName,implClass);
    }

    /**
     * 服务获取
     * @param serviceName
     * @return
     */
    public static Class<?> get(String serviceName){
        return map.get(serviceName);
    }

    /**
     * 服务删除
     * @param serviceName
     */
    public static void remove(String serviceName){
        map.remove(serviceName);
    }

}
